package com.lewis.module.m2.api.luck.api;

import com.lewis.common.core.entity.BaseResult;
import com.lewis.module.m2.api.luck.service.ILuckDayService;
import com.lewis.module.m2.api.luck.entity.LuckDay;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 每日运势查询表 前端控制器
 * </p>
 *
 * @author lewis
 * @since 2021-12-01
 */
@Api(tags = "每日运势记录")
@RestController
@RequestMapping("/api/luck/day")
public class LuckDayApi {

	@Resource
	private ILuckDayService luckDayService;

	@ApiModelProperty(value = "根据时间和QQ查询记录")
	@GetMapping("/getOneByCtimeAndQq")
	public BaseResult getOneByCtimeAndQq(LuckDay luckDay) {
		return luckDayService.getOneByCtimeAndQq(luckDay);
	}

	@ApiModelProperty(value = "新增记录", notes = "0：失败 1：成功")
	@PostMapping("/add")
	public Integer add(@RequestBody LuckDay luckDay) {
		return luckDayService.save(luckDay) ? 1 : 0;
	}
}
